#pragma once

#include <fstream>
#include <string>
#include <unordered_map>
#include <iostream>
#include  "Util.hpp"
namespace ns_Log{

        enum MsgLevel{
            Info,
            Debug,
            Warning,
            Error,
            Fatal
        };
        const std::unordered_map<MsgLevel, std::string> msgLevelToString = {
        {MsgLevel::Info, "Info"},
        {MsgLevel::Debug, "Debug"},
        {MsgLevel::Warning, "Warning"},
        {MsgLevel::Error, "Error"},
        {MsgLevel::Fatal, "Fatal"}
        };

    class Log{
        
    public:
        
        inline std::string WriteLog(MsgLevel level,const std::string &file_name,int line)const
        {
            std::string msg;
            msg+="[";
            msg += msgLevelToString.at(level);
            msg+= "]";
            msg+="[";
            msg += file_name;
            msg+= "]";
            msg+="[";
            msg += std::to_string(line);
            msg+= "]";
            msg+="[";
            msg += ns_Util::TimeUtil::GetNowTimeString();
            msg+= "]";
            return msg;
        }
        std::string operator()(MsgLevel level,const std::string &file_name,int line)const 
        {
            return WriteLog(level,file_name,line);
        }
    };
    const static Log lg;
};